
/**
 * 合并静态路由和动态路由
 */

// 导入静态路由
import { constantRoutes } from '@/router/index'
export default {
  namespaced: true, // 开启命名空间
  state: () => ({
    routes: constantRoutes // 静态路由
  }),
  mutations: {
    setRoutes(state, asyncRoutes) {
      // 合并路由
      state.routes = [...constantRoutes, ...asyncRoutes]
    }
  }
}
